﻿<%@ Page Title="" Language="C#" MasterPageFile="~/HomeAdmin.Master" AutoEventWireup="true" CodeBehind="Admin_View.aspx.cs" Inherits="Small.Admin_ViewUpdate" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
    AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" 
    DataKeyNames="ProductID" DataSourceID="SqlDataSource1" 
    EmptyDataText="There are no data records to display." ForeColor="#333333" 
    GridLines="None">
    <AlternatingRowStyle BackColor="White" />
    <Columns>
        <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
        <asp:ImageField DataImageUrlField="Images">
            <ControlStyle Height="100px" Width="100px" />
        </asp:ImageField>
        <asp:BoundField DataField="ProductID" HeaderText="ProductID" ReadOnly="True" 
            SortExpression="ProductID" />
        <asp:BoundField DataField="ProductName" HeaderText="ProductName" 
            SortExpression="ProductName" />
        <asp:BoundField DataField="ProductInfomation" HeaderText="ProductInfomation" 
            SortExpression="ProductInfomation" />
        <asp:BoundField DataField="ProductPrice" HeaderText="ProductPrice" 
            SortExpression="ProductPrice" />
        <asp:BoundField DataField="Images" HeaderText="Images"  
            SortExpression="Images" />
        <asp:TemplateField>
        </asp:TemplateField>
    </Columns>
    <EditRowStyle BackColor="#2461BF" />
    <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
    <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
    <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
    <RowStyle BackColor="#EFF3FB" />
    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
    <SortedAscendingCellStyle BackColor="#F5F7FB" />
    <SortedAscendingHeaderStyle BackColor="#6D95E1" />
    <SortedDescendingCellStyle BackColor="#E9EBEF" />
    <SortedDescendingHeaderStyle BackColor="#4870BE" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
    ConnectionString="<%$ ConnectionStrings:ShopDBConnectionString1 %>" 
    DeleteCommand="DELETE FROM [Product] WHERE [ProductID] = @ProductID" 
    InsertCommand="INSERT INTO [Product] ([ProductName], [ProductInfomation], [ProductPrice], [Images]) VALUES (@ProductName, @ProductInfomation, @ProductPrice, @Images)" 
    ProviderName="<%$ ConnectionStrings:ShopDBConnectionString1.ProviderName %>" 
    SelectCommand="SELECT [ProductID], [ProductName], [ProductInfomation], [ProductPrice], [Images] FROM [Product]" 
    UpdateCommand="UPDATE [Product] SET [ProductName] = @ProductName, [ProductInfomation] = @ProductInfomation, [ProductPrice] = @ProductPrice, [Images] = @Images WHERE [ProductID] = @ProductID">
    <DeleteParameters>
        <asp:Parameter Name="ProductID" Type="Int32" />
    </DeleteParameters>
    <InsertParameters>
        <asp:Parameter Name="ProductName" Type="String" />
        <asp:Parameter Name="ProductInfomation" Type="String" />
        <asp:Parameter Name="ProductPrice" Type="String" />
        <asp:Parameter Name="Images" Type="String" />
    </InsertParameters>
    <UpdateParameters>
        <asp:Parameter Name="ProductName" Type="String" />
        <asp:Parameter Name="ProductInfomation" Type="String" />
        <asp:Parameter Name="ProductPrice" Type="String" />
        <asp:Parameter Name="Images" Type="String" />
        <asp:Parameter Name="ProductID" Type="Int32" />
    </UpdateParameters>
</asp:SqlDataSource>
</asp:Content>
